<?php

/**
 *      Author Huazi.
 *
 *      
 *      $Id: Service.php 2016-04-08 14:11:44 huazi $
 */

class ServiceModel extends \Core_CMode {

    public $_table = '`yaf_service`';

    /**
     * @return array customized attribute labels (name=>label)
     */
    public function attributeLabels() {
        return array(
            'ser_id' => '业务分类id', 
            'ser_name' => '业务分类名称', 
            'ser_code' => '业务分类代码',
            'special_bill' => '增值税专用发票比率',
            'normal_bill' => '增值税普通发票比率',
            'content' => '描述',
            'sort' => '排序',
            'addtime' => '添加时间',
        );
    }

    /**
     * 楠岃瘉瑙勫垯
     *
     */
    public function rules() {
        return array(
            'default'=> array(
                array('ser_name', 'required|maxlength[30]'),
                array('ser_code', 'required|maxlength[10]'),
                array('special_bill', 'maxlength[3]|integer'),
                array('normal_bill', 'maxlength[3]|integer'),
                array('content', 'maxlength[250]'),
                array('sort', 'integer'),
                array('addtime', 'required|maxlength[20]'),

            ),
            'only_add'=> array(
                array('ser_name', 'required|maxlength[50]'),
                array('ser_code', 'required|maxlength[10]'),
                array('sort', 'integer'),
                array('addtime', 'required|maxlength[20]'),

            ),
        );
    }

    /**
     * 鎵归噺鍒犻櫎
     *
     */
    public function delServices($ids) {
        $ids_str = implode(',', $ids);
        $where = 'ser_id IN ('.$ids_str.')';
        return $this->delete($where);
    }
}

?>
